<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="jquery/dist/jquery.min.js"></script>
</head>
<body>
    <input type="button" value="按钮" id="btn1">
    <input type="button" value="按钮" id="btn2">


    <script>
        $(function(){
            $("#btn1").on("click",function(){
                fetch("/login").then(res=>{
                return res.json()
            }).then(data=>{
                console.log(data)
                localStorage.setItem("jwt",data.msg)
            })
        }) 
        
        
        $("#btn2").on("click",function(){
            alert(localStorage.jwt);
                fetch(`/api/ui?token=${localStorage.jwt}`).then(res=>{
                return res.json()
            }).then(data=>{
                console.log(data)
            })
        })
    })
    </script>
</body>
</html>